package db;

import org.apache.commons.lang.RandomStringUtils;
import sf.database.jdbc.type.JavaType;
import sf.tools.StringUtils;

import java.sql.Types;
import java.time.LocalDate;
import java.time.Period;
import java.time.ZoneId;
import java.util.Calendar;

public class T2 {
    public static void main(String[] args) {
        JavaType.isLob(Types.VARCHAR);
        System.out.println(System.currentTimeMillis());

        Double d1 = 134d;
        Double d2 = 134.0d;
        System.out.println(Double.doubleToLongBits(d1)==Double.doubleToLongBits(d2));

        Calendar cal = Calendar.getInstance();
        cal.add(Calendar.DAY_OF_YEAR,-1);
        cal.set(Calendar.HOUR_OF_DAY,23);
        System.out.println(cal.getTime());

        LocalDate lastAllToCsvLocalDate = cal.getTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
        LocalDate localDate = LocalDate.now();
        Period period = Period.between(lastAllToCsvLocalDate, localDate);
        System.out.println(period.getDays());
        getRadomString();
    }

    public static void getRadomString(){
        long l = System.currentTimeMillis();
        for (int i = 0; i < 1000000; i++) {
            RandomStringUtils.random(32, true, true);
        }
        System.out.println((System.currentTimeMillis()-l)+"ms");

        l = System.currentTimeMillis();
        for (int i = 0; i < 1000000; i++) {
            StringUtils.uuid32();
        }
        System.out.println((System.currentTimeMillis()-l)+"ms");
    }
}
